package com.test.sharding.manage;

import com.test.sharding.dao.ValueDynamicDao;
import com.test.sharding.dao.ValueOneDao;
import com.test.sharding.model.ValueDynamic;
import com.test.sharding.model.ValueOne;
import com.test.sharding.util.IdWorker;
import com.test.sharding.utils.ValueUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.Random;

@Component
public class ValueManage {

    @Autowired
    ValueDynamicDao valueDynamicDao;
    @Autowired
    ValueOneDao valueOneDao;

    @Transactional
    public Boolean testCreate() {


        valueDynamicDao.create(ValueUtil.getValueDynamic());

        Boolean result = valueOneDao.create(ValueUtil.getValueOne());

        return result;
    }

    @Transactional
    public Boolean testCreates(int size) {
        valueDynamicDao.creates(ValueUtil.getValueDynamicList(size));

        valueOneDao.creates(ValueUtil.getValueOneList(size));

        int a = 10 / 0;

        return true;
    }

}
